#!/usr/bin/env python
# encoding: utf-8

from app.views.api import route_api
from  flask import request,jsonify,g
import requests,json,decimal

from app import db
from app.model import Product

from app.common.libs.Logging import logger
from app.common.libs.Helper import getFormatDate, stringToDatetime

from sqlalchemy import func

@route_api.route("/product/search",methods = [ "GET","POST" ])
def productSearch():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    return jsonify( resp )

@route_api.route("/product/delete",methods = [ "GET","POST" ])
def productDelete():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    return jsonify( resp )

@route_api.route("/product/edit",methods = [ "GET","POST" ])
def productEdit():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    return jsonify( resp )

@route_api.route("/product/list",methods = [ "GET","POST" ])
def productList():
    resp = { 'code':20000,'msg':'操作成功~', 'data':{}}
    products = [ {'name':p.name} for p in db.session.query(Product).all() ]
    resp['data'] = products
    return jsonify( resp )


